import time
from datetime import datetime

import falcon

from WebBackend.utils import mylog
from WebBackend.utils.jwt_tools import generate_jwt, decode_jwt
import App_setting as setting


class Checkin:

    async def on_get(self, req, resp):
        cookie = req.get_cookie_values('nibiru')

        if cookie:
            status, text = decode_jwt(token=cookie[0])
            if status == 200:
                resp.media = {
                    'status': 200
                }
            else:
                resp.media = {
                    'status': status,
                    'text': text
                }
        else:
            resp.media = {
                'status': 404,
                'text': 'JWT丢失，请重新登录'
            }
